package com.exceptions;

public class ExceptionFinally {

	static int count = 0;

	public static void main(String[] args) {
		print();
		get();
		System.out.println(set());
	}

	public static void print() {
		try {
			int a = 10;
			if (a == 10) {
				System.out.println(a);
				return;
			}
		} finally {
			System.out.println("Finally");
		}
	}

	public static void get() {
		while (true) {
			try {
				if (count++ == 0)
					throw new Exception();
				System.out.println("No Exception");
			} catch (Exception e) {
				System.out.println("Exception throw");
			} finally {
				System.out.println(" in  finally clause");
				if (count == 2)
					break;
			}
		}
	}

	public static int set() {
		int i = 0;
		try {
			System.out.println(i);
			return i;
		} finally {
			i++;
			System.out.println(i);
		}

	}
}
